@extends('admin.app')

@section('breadcrumb')
  <div class="bg-light lter b-b wrapper-md">
    <ol class="breadcrumb bg-light lter m-n no-padder">
      <li><a href="{{admin_action('HomeController@index')}}">主页</a></li>
      <li><a href="{{admin_action('Web\ProfitsController@index')}}">分润规则</a></li>
      <li class="active">分润规则信息</li>
    </ol>
  </div>
@endsection

@section('content')
  <div class="panel panel-default">
    <div class="panel-heading font-bold">
      分润规则列表
    </div>
    <div class="row wrapper">
      <div class="col-sm-12 text-right text-center-xs">
        <a class="btn m-b-xs btn-default btn-addon" href="{{ admin_action('Web\ProfitsController@create') }}">
          <i class="fa fa-plus"></i>新增分润规则
        </a>
      </div>
    </div>
    <div class="table-responsive">
      <table class="table table-striped b-t b-light">
        <thead>
        <tr>
          <th style="width: 10px">#</th>
          <th>名称</th>
          <th>分润阶段</th>
          <th>分润方式</th>
          <th>状态</th>
          <th style="width: 150px">操作</th>
        </tr>
        </thead>
        <tbody>
        @forelse($profits as $profit)
          <tr>
            <td>{{$profit->id}}</td>
            <td><a href="{{admin_action('Web\ProfitsController@show',[$profit])}}" class="text-info-dker">{{$profit->name}}</a></td>
            <td>
              @foreach($stages as $stage)
                {{$stage->name }}&nbsp;
              @endforeach
            </td>
            <td>{{$profit->mode()->name}}</td>
            <td>{{$profit->state?'已启用':'已禁用'}}</td>
            <td>
              <a href="{{admin_action('Web\ProfitsController@edit',[$profit])}}" class="btn btn-primary btn-xs" title="编辑信息" ><i class="fa fa-pencil"></i></a>
              <form class="inline" method="post" action="{{admin_action('Web\ProfitsController@destroy',[$profit])}}">
                {{ method_field('DELETE') }}
                {{ csrf_field() }}
                <button type="button" data-swal-role="delete-confirm" class="btn btn-xs btn-danger" data-toggle="tooltip" title="删除信息">
                  <i class="fa fa-trash-o"></i>
                  </button>
              </form>
              <a href="/admin/web/profits/disable/{{$profit->id}}" class="{{$profit->state?'label label-success':'label label-warning'}}" title="{{$profit->state?'禁用规则':'启用规则'}}" data-toggle="tooltip">{{$profit->state?'禁用':'启用'}}</a>
            </td>
          </tr>
        @empty
          <tr>
            <td colspan="3" class="text-center">没有找到分润规则记录</td>
          </tr>
        @endforelse
        </tbody>
      </table>
    </div>
    <div class="panel-footer">
      <div class="row">
        <div class="col-sm-12 text-right text-center-xs">
          {{ $links }}
        </div>
      </div>
    </div>
  </div>
  <!-- Default box -->

@endsection